<?php
	require('config.php');
	$user_id=$_REQUEST['user_id'];
    $wb_id=$_REQUEST['wb_id'];
    $sql="select * from ".$oto."_help where id='{$wb_id}'";
	$result=$db->query($sql);
	while($row=$result->fetch_assoc()){
		$help[]=$row;//将取得的所有数据赋值给person_info数组
	}
	if(isset($help))
	{
		$ywb_user_id=$help[0]['userId'];
		if($user_id==$ywb_user_id)
		{
			$sql="select * from ".$oto."_help_orders where helpId='{$wb_id}' and userId='{$user_id}' and isDel='0' and orderStatus not in ('-1','-2','-5','-6')";
			$result=$db->query($sql);
			while($row=$result->fetch_assoc()){
				$order[]=$row;//将取得的所有数据赋值给person_info数组
			}
			if(isset($order))
			{
				$order_id=$order[0]['id'];
				$to_user_id=$order[0]['acceptUserId'];
				$data[0]['time']=$order[0]['overTime'];
				$sql="select * from ".$oto."_users where userId='{$to_user_id}'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$users[]=$row;//将取得的所有数据赋值给person_info数组
				}
				if(isset($users))
				{
					$data[0]['userPhoto']=$users[0]['userPhoto'];
					$data[0]['userName']=$users[0]['userName'];
				}
				$sql="select * from ".$oto."_help_star where helpId='{$wb_id}' and userId='{$user_id}' and isDel='0'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$pingjia[]=$row;//将取得的所有数据赋值给person_info数组
				}
				if(isset($pingjia))
				{
					$data[0]['isPj']=1;
					$data[0]['star']=$pingjia[0]['star'];
				}
				else
				{
					$data[0]['isPj']=0;
				}
			}
		}
		else
		{
			$sql="select * from ".$oto."_help_orders where helpId='{$wb_id}' and acceptUserId='{$user_id}' and isDel='0' and orderStatus not in ('-1','-2','-5','-6')";
			$result=$db->query($sql);
			while($row=$result->fetch_assoc()){
				$order[]=$row;//将取得的所有数据赋值给person_info数组
			}
			if(isset($order))
			{
				$order_id=$order[0]['id'];
				$to_user_id=$order[0]['userId'];
				$data[0]['time']=$order[0]['overTime'];
				$sql="select * from ".$oto."_users where userId='{$to_user_id}'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$users[]=$row;//将取得的所有数据赋值给person_info数组
				}
				if(isset($users))
				{
					$data[0]['userPhoto']=$users[0]['userPhoto'];
					$data[0]['userName']=$users[0]['userName'];
				}
				$sql="select * from ".$oto."_help_star where helpId='{$wb_id}' and userId='{$user_id}' and isDel='0'";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$pingjia[]=$row;//将取得的所有数据赋值给person_info数组
				}
				if(isset($pingjia))
				{
					$data[0]['isPj']=1;
					$data[0]['star']=$pingjia[0]['star'];
				}
				else
				{
					$data[0]['isPj']=0;
				}
			}
		}
	}
	echo json_encode($data);
?>